package view.component.monster.large_monster
{
	import enums.main.UISize;
	
	import feathers.controls.Label;
	import feathers.data.ListCollection;
	
	import model.vo.monster.LMonsterAppearVo;
	
	import view.component.BaseSCListView;
	import view.render.monster.LMonsterAppearListItem;
	
	
	/**
	 * 大型怪物详细-出现任务界面
	 * @author £iang
	 * 
	 */	
	public class LMDetailAppearView extends BaseSCListView
	{
		//-----------------------------
		// variables
		//-----------------------------
		
		/** 区别标题 */
		public var distinctionTitle:Label;
		/** 难度标题 */
		public var levelTitle:Label;
		/** 血量标题 */
		public var hpTitle:Label;
		/** 攻击倍率标题 */
		public var attackTitle:Label;
		/** 防御倍率标题 */
		public var defenceTitle:Label;
		/** 硬直倍率标题 */
		public var fearTitle:Label;
		/** 备注标题 */
		public var psTitle:Label;
		
		//-----------------------------
		// properties
		//-----------------------------
		
		//-----------------------------
		// setter&getter
		//-----------------------------
		
		//-----------------------------
		// methods
		//-----------------------------
		
		/**
		 * 初始化函数 
		 * 
		 */		
		override protected function initialize():void
		{ 
			_itemH = UISize.LMONSTER_AP_ITEM_H * this.dpiScale;
			_listH = UISize.MAIN_H - 
				( UISize.MONSTER_TAB_AREA_H + 
					UISize.LMONSTER_DETAIL_TAB_AREA_H +
					UISize.LIST_TITLE_H ) * this.dpiScale;
			_scrollerMaxPage = 2;
			_firstName = "任务名";
			super.initialize();
		}
		
		override protected function initializeOther():void
		{
			super.initializeOther();
			distinctionTitle = new Label();
			distinctionTitle.text = "区分";
			distinctionTitle.textRendererProperties.wordWrap = true;
			scollerContainer.addChild( distinctionTitle );
			
			levelTitle = new Label();
			levelTitle.text = "难度";
			levelTitle.textRendererProperties.wordWrap = true;
			scollerContainer.addChild( levelTitle );
			
			hpTitle = new Label();
			hpTitle.text = "血量";
			hpTitle.textRendererProperties.wordWrap = true;
			scollerContainer.addChild( hpTitle );
			
			attackTitle = new Label();
			attackTitle.text = "攻击";
			attackTitle.textRendererProperties.wordWrap = true;
			scollerContainer.addChild( attackTitle );
			
			defenceTitle = new Label();
			defenceTitle.text = "防御";
			defenceTitle.textRendererProperties.wordWrap = true;
			scollerContainer.addChild( defenceTitle );
			
			fearTitle = new Label();
			fearTitle.text = "硬直";
			fearTitle.textRendererProperties.wordWrap = true;
			scollerContainer.addChild( fearTitle );
			
			psTitle = new Label();
			psTitle.text = "备注";
			psTitle.textRendererProperties.wordWrap = true;
			scollerContainer.addChild( psTitle );
		}
		
		/**
		 * 绘制函数 
		 * 
		 */		
		override protected function draw():void
		{
			var labelY:Number = ( UISize.LIST_TITLE_H - 
				43 ) / 2 * this.dpiScale;
			var leftPadding:Number = UISize.TITLE_PADDING_LEFT * this.dpiScale;
			var firstLabelFullW:Number;
			
			firstTitle.y = labelY;
			firstTitle.x = leftPadding;
			firstLabelFullW = UISize.MAIN_W * 0.4;
			firstTitle.width = firstLabelFullW - leftPadding;
			
			scollerContainer.x = firstLabelFullW;
			scollerContainer.width = UISize.MAIN_W - firstLabelFullW;
			scollerContainer.height = UISize.LIST_TITLE_H;
			
			distinctionTitle.y = labelY;
			distinctionTitle.x = 0;
			distinctionTitle.width  = UISize.MAIN_W * 0.2;
			
			levelTitle.y = labelY;
			levelTitle.x = UISize.MAIN_W * 0.2;
			levelTitle.width  = UISize.MAIN_W * 0.2;
			
			hpTitle.y = labelY;
			hpTitle.x = UISize.MAIN_W * 0.4;
			hpTitle.width  = UISize.MAIN_W * 0.2;
			
			attackTitle.y = labelY;
			attackTitle.x = UISize.MAIN_W * 0.6;
			attackTitle.width  = UISize.MAIN_W * 0.2;
			
			defenceTitle.y = labelY;
			defenceTitle.x = UISize.MAIN_W * 0.8;
			defenceTitle.width  = UISize.MAIN_W * 0.2;
			
			fearTitle.y = labelY;
			fearTitle.x = UISize.MAIN_W * 1;
			fearTitle.width  = UISize.MAIN_W * 0.2;
			
			psTitle.y = labelY;
			psTitle.x = UISize.MAIN_W * 1.2;
			psTitle.width  = UISize.MAIN_W * 0.6;
			
			var buttonY:Number = ( UISize.LIST_TITLE_H * this.dpiScale - leftButton.height ) / 2;
			
			leftButton.x = firstLabelFullW - leftButton.width;
			leftButton.y = buttonY;
			
			rightButton.x = UISize.MAIN_W - leftButton.width;
			rightButton.y = buttonY;
			
			list.y = UISize.LIST_TITLE_H * this.dpiScale;
		}
		
		/**
		 * 设置列表数据 
		 * @param dataVec 数据
		 * 
		 */		
		public function setListData( dataVec:Vector.<LMonsterAppearVo> ):void
		{
			var i:int;
			var len:int = dataVec.length;
			
			_listData = new ListCollection([]);
			
			for( i = 0; i < len; i++)
			{
				var item:LMonsterAppearListItem = new LMonsterAppearListItem();
				var tmpData:LMonsterAppearVo = dataVec[ i ] as LMonsterAppearVo;
				
				item.setData( tmpData );
				_listData.push( { item:item, itemData:tmpData } );
			}
			
			list.dataProvider = _listData;
		}
		
		//-----------------------------
		// events
		//-----------------------------
		
		//-----------------------------
		// dispose
		//-----------------------------
	
		/**
		 * 析构函数 
		 * 
		 */		
		protected override function disposeAnythingInContainer():void
		{
			disposeLabels( [
				"distinction", "level", "hp",
				"attack", "defence", "fear", 
				"ps"
			] );
		}
		
		//-----------------------------
		// construction
		//-----------------------------
		
		/**
		 * 构造函数
		 *
		 */
		public function LMDetailAppearView()
		{
			super();
		}
	}
}